package com.yidu.verycd_reception.controller;

import com.yidu.util.Tools;
import com.yidu.verycd_reception.entity.VerycdUser;
import com.yidu.verycd_reception.service.VerycdUserService;
import com.yidu.verycd_reception.util.BaseMessage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (VerycdUser)表控制层
 *
 * @author makejava
 * @since 2020-07-29 09:54:21
 */
@RestController
@RequestMapping("verycdUser")
public class VerycdUserController {
    /**
     * 服务对象
     */
    @Resource
    private VerycdUserService verycdUserService;



    /**
     * 查询所有
     * @param verycdUser
     * @return
     */
    @RequestMapping("findAll")
    @ResponseBody
    public Map<String,Object> findAll(VerycdUser verycdUser){


        return  verycdUserService.findAll(verycdUser);

    }

    /**
     * 删除用户
     * @param userId
     * @return
     */
    @RequestMapping("deleteById")
    @ResponseBody
    public BaseMessage deleteById(Integer userId){

        return verycdUserService.deleteById(userId);
    }

    /**
     * 增加用户
     * @param verycdUser
     * @return
     */
    @RequestMapping("insertOrUpdate")
    @ResponseBody
    public BaseMessage insertOrUpdate(VerycdUser verycdUser){

        return verycdUserService.insertOrUpdate(verycdUser);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param userId 主键
     * @return 单条数据
     */
    @RequestMapping("selectOne")
    @ResponseBody
    public VerycdUser selectOne(Integer userId) {

        return this.verycdUserService.selectOne(userId);
    }

    /**
     * 注册
     * @param verycdUser
     * @return
     */
    @RequestMapping("dyRegist")
    @ResponseBody
    public BaseMessage dyRegist(VerycdUser verycdUser){

        return verycdUserService.dyRegist(verycdUser);
    }

    /**
     * 登录
     * @param verycdUser
     * @return
     */
    @RequestMapping("dyLogin")
    @ResponseBody
    public BaseMessage dyLogin(VerycdUser verycdUser){

        return verycdUserService.dyLogin(verycdUser);
    }

}